# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=hwdata
pkgver=0.388
pkgrel=0
pkgdesc="Hardware identification and configuration data"
url="https://github.com/vcrhonek/hwdata"
arch="noarch"
license="GPL-2.0-or-later OR XFree86-1.1"
subpackages="$pkgname-dev $pkgname-usb $pkgname-pci $pkgname-pnp $pkgname-net"
source="$pkgname-$pkgver.tar.gz::https://github.com/vcrhonek/hwdata/archive/refs/tags/v$pkgver.tar.gz"
options="!check" # just firmware data

replaces="hwids"
# be higher since hwids was a large date version
provides="hwids=20220101-r$pkgrel"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--disable-blacklist
}

package() {
	depends="
		$pkgname-usb=$pkgver-r$pkgrel
		$pkgname-pci=$pkgver-r$pkgrel
		$pkgname-pnp=$pkgver-r$pkgrel
		$pkgname-net=$pkgver-r$pkgrel
		"
	make DESTDIR="$pkgdir" install
}

dev() {
	default_dev
	depends="$pkgname=$pkgver-r$pkgrel"
}

usb() {
	pkgdesc="$pkgdesc (usb data)"
	provides="hwids-usb=20220101-r$pkgrel"
	replaces="hwids-usb"

	amove usr/share/hwdata/usb.ids
}

pci() {
	pkgdesc="$pkgdesc (pci data)"
	provides="hwids-pci=20220101-r$pkgrel"
	replaces="hwids-pci"

	amove usr/share/hwdata/pci.ids
}

net() {
	pkgdesc="$pkgdesc (net data)"
	provides="hwids-net=20220101-r$pkgrel"
	replaces="hwids-net"

	amove usr/share/hwdata/oui.txt
	amove usr/share/hwdata/iab.txt
}

pnp() {
	pkgdesc="$pkgdesc (pnp data)"

	amove usr/share/hwdata/pnp.ids
}

sha512sums="
4f018e2e75385028256eafa7c6bb93d7446e07ee25e7bfa2bb9ab566ae6938cb3646ed50e71b53c7367fc70252d25a5c8f112d1957e016283f933b9d5f527c4b  hwdata-0.388.tar.gz
"
